package com.yuan.algorithms.practice201504;

import java.util.Scanner;

public class 计算N个3的和 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = sc.nextInt();
			int[] sum = new int[10000];
			for (int i = 1; i <= n; i++) {
				for (int j = 1; j <= i; j++) {
					sum[j] += 3; 
					if (sum[j]>9) {
						sum[j+1]++;
						sum[j] %= 10; 
					}
				}
				
			}
			for (int i = 9999, k = 0; i > 0; i--) {
				if (sum[i]!=0 || k > 0) {
					k = 1;
					System.out.print(sum[i]);
				}
			}
			System.out.println();
		}

	}

}
